<?php
/**
 * 商品评论
 * User: yuanxuncheng
 * Date: 2017/1/2
 * Time: 21:45
 */

namespace app\api\controller;

use app\api\model\page\comment\GetComment as GetCommentModel;
use app\api\model\page\comment\GetCommentByUserid as GetCommentByUseridModel;
use app\api\model\page\comment\GetCommentByGoodsid as GetCommentByGoodsidModel;
use app\api\model\page\comment\AddComment as AddCommentModel;
use think\Request;

class Comment
{

    private $addCommentModel;
    private $getCommentModel;
    private $getCommentByUseridModel;
    private $getCommentByGoodsidModel;

    public function __construct()
    {
        $this->param = Request::instance()->param();
    }

    /**
     * @desc 增加评论
     * @return array
     */
    public function addComment()
    {
        $this->addCommentModel = new AddCommentModel();
        return $this->addCommentModel->excute($this->param);
    }

    /**
     * @desc 根据用户获取评价
     * @return array
     */
    public function getCommentByUserid()
    {
        $this->getCommentByUseridModel = new GetCommentByUseridModel();
        return $this->getCommentByUseridModel->excute($this->param);
    }

    /**
     * @desc 商品评论
     * @return array
     */
    public function getComment()
    {
        $this->getCommentModel = new GetCommentModel();
        return $this->getCommentModel->excute($this->param);
    }

    /**
     * @desc 根据商品获取评价
     * @return array
     */
    public function getCommentByGoodsid()
    {
        $this->getCommentByGoodsidModel = new GetCommentByGoodsidModel();
        return $this->getCommentByGoodsidModel->excute($this->param);
    }
}
